<template>
  <el-dialog
    :visible.sync="dialogFormVisible"
    :close-on-click-modal="false"
    class="small-common-dialog-size"
    @close="closeDialog">
    <Title title="请输入权限说明" />
    <div class="main">
      <el-input v-model="remarks" placeholder="不超过500字符" type="textarea" maxlength="500" resize="none" rows="3" />
    </div>
    <div class="btn">
      <el-button type="primary" size="small" @click="toSubmit()">保存</el-button>
      <el-button type="info" size="small" class="cancel-btn-style" @click="closeDialog">取消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import Title from '@/components/Title';
export default {
  components: { Title },
  data() {
    return {
      dialogFormVisible: false,
      remarks: '',
      params: {}
    };
  },
  methods: {
    closeDialog() {
      this.dialogFormVisible = false;
      this.remarks = '';
    },
    openDialog(data) {
      this.dialogFormVisible = true;
      this.remarks = data.remarks;
      this.params = data;
    },
    toSubmit() {
      const params = this.params;
      this.$emit('handelOk', params, this.remarks);
      this.closeDialog();
    }
  }
};
</script>

<style lang="scss" scoped>
.main {
  margin-top: 16px;
  margin-bottom: 32px;
}
.btn {
  display: flex;
  justify-content: center;
}
</style>
